<template>
  <el-result
      :icon="printing.icon"
      :sub-title="printing.subTitle"
      :title="printing.title"
  >
    <template #extra>
      <el-button type="primary" @click="handleConfirmOrder">
        确定收货
      </el-button>
    </template>
  </el-result>
</template>

<script setup>
import {reactive} from 'vue'
import {useRouter} from "vue-router";
import {useOrderDetailsStore} from "@/stores/order.js";
import {okOrder} from "@/apis/order.js";

const router = useRouter()
const orderDetailsStore = useOrderDetailsStore()
const printing = reactive({
  title: "打印完成",
  icon: "success",
  subTitle: "即将通过快递发货，注意查收"
})
const handleConfirmOrder = () => {
  okOrder(orderDetailsStore.order.id).then(() => {
    orderDetailsStore.order.status = 7
    router.push({name: "muterorder"})
    // window.location.reload()
  })
}
</script>